<div class="dsc-receipt-info">
    <div class="dsc-receipt-info-title">
        <h3>{$Think.lang.consignee_information}</h3>
        <a href="javascript:void(0)" ds_type="buy_edit" id="edit_reciver">[{$Think.lang.modification}]</a></div>
    <div id="addr_list" class="dsc-candidate-items">
        <ul>
            <li>
                <span class="true-name">{$address_info.address_realname}</span>
                <span class="address">{$address_info.area_info}{$address_info.address_detail}</span>
                <span class="phone"><i class="iconfont">&#xe60e;</i>{if condition="$address_info.address_mob_phone"}{$address_info.address_mob_phone}{else}{$address_info.address_tel_phone}{/if}</span>
            </li>
        </ul>
    </div>
</div>

<script type="text/javascript">
//判断配送范围    
    function calcDistance(addr_id){
        var url = HOMESITEURL + '/Buy/calc_distance.html';
        $.ajax({ url:url, data:{'store_ids': '{$store_ids}',addr_id: addr_id},dataType:'json', success:function(data) {
            if(data.state){
                ALLOW_ADDRESS=true;
            }else{
                ALLOW_ADDRESS=false;
                ALLOW_ADDRESS_MSG=data.msg;
            }
        },error:function(data){
            ALLOW_ADDRESS=false;
            ALLOW_ADDRESS_MSG='{$Think.lang.o2o_distance_request_error}';
        }})
    }
//隐藏收货地址列表
    function hideAddrList(addr_id, true_name, address, phone) {
        $('#edit_reciver').show();
        $("#address_id").val(addr_id);
        $("#addr_list").html('<ul><li><span class="true-name">' + true_name + '</span><span class="address">' + address + '</span><span class="phone"><i class="iconfont">&#xe60e;</i>' + phone + '</span></li></ul>');
        $('.current_box').removeClass('current_box');
        ableOtherEdit();
        $('#edit_payment').click();
    }
//加载收货地址列表
    $('#edit_reciver').on('click', function() {
        $(this).hide();
        disableOtherEdit('{$Think.lang.save_consignee_information} ');
        $(this).parent().parent().addClass('current_box');
        var url = HOMESITEURL + '/Buy/load_addr.html';
        $('#addr_list').load(url);
    });
    

    $(function() {
        {notempty name="$address_info.address_id"}
						calcDistance({$address_info.address_id});
        {else /}
            $('#edit_reciver').click();
        {/notempty}
    });
    
</script>